package top.jingwenmc.litequeue;

import top.jingwenmc.litequeue.classes.PlayerManager;
import top.jingwenmc.litequeue.util.ConfigAccessor;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;
import top.jingwenmc.litequeue.util.MessageUtil;

public final class main extends JavaPlugin {
    public static String version = "v1.0-SNAPSHOT";
    private static main instance = null;
    private ConfigAccessor configAccessor = new ConfigAccessor(this,"translate.yml");
    private ConfigAccessor mainConfigAccessor = new ConfigAccessor(this,"config.yml");
    private PlayerManager playerManager;
    @Override
    public void onEnable() {
        Bukkit.getLogger().info(ChatColor.AQUA+"[LiteQueue]Initializing...");
        configAccessor.saveDefaultConfig();
        mainConfigAccessor.saveDefaultConfig();
        instance = this;
        MessageUtil.sendConsole("console.loading");
        try {
            playerManager = new PlayerManager();
        }
        catch (Exception e) {
            MessageUtil.sendConsole("console.error_occurred");
            e.printStackTrace();
            Bukkit.getPluginManager().disablePlugin(this);
        }
        MessageUtil.sendConsole("console.post_load");
        // Plugin startup logic
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
        MessageUtil.sendConsole("console.shutdown");
    }
    public static main getInstance(){return instance;}
    public ConfigAccessor getConfigAccessor(){return configAccessor;}
    public ConfigAccessor getMainConfigAccessor() { return mainConfigAccessor; }

    public PlayerManager getPlayerManager() {
        return playerManager;
    }
}
